-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding weighted and unweighted polygon offsets using polygon skeletons #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, just a few suggestions
""" | ||
points = list(points) | ||
if not TOL.is_allclose(normal_polygon(points, True), [0, 0, 1]): | ||
raise ValueError("Please pass a polygon with a normal vector of [0, 0, 1].") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps something like this is more informative?
"The normal of the polygon should be [0, 0, 1]. The normal of the provided polygon is {}".format(normal_points(points))
@@ -66,3 +66,76 @@ def create_interior_straight_skeleton_with_holes(points, holes) -> PolylinesNump | |||
hole = np.asarray(points, dtype=np.float64) | |||
H.append(hole) | |||
return straight_skeleton_2.create_interior_straight_skeleton_with_holes(V, H) | |||
|
|||
|
|||
def create_offset_polygons_2(points, offset): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code is CPython exclusive, so you could add type annotations...
|
||
Returns | ||
------- | ||
list of Polygon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list[:class:Polygon
]
return [Polygon(points.tolist()) for points in offset_polygons] | ||
|
||
|
||
def create_weighted_offset_polygons_2(points, offset, weights): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type annotations?
|
||
Returns | ||
------- | ||
list of Polygon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list[:class:Polygon
]
"create_offset_polygons_2_inner", | ||
&pmp_create_offset_polygons_2_inner, | ||
pybind11::arg("V").noconvert(), | ||
pybind11::arg("offset").noconvert()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think noconvert
is needed on basic types, but i am not sure...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i left that one as is
Thank you! I've implemented the suggestions |
See https://doc.cgal.org/latest/Straight_skeleton_2/index.html